<template>
	<view class="page">
		<nav-bar title="储值卡充值记录" bgColor="#FFF" titleColor="#000"></nav-bar>
		<scroll-view scroll-y :style="{ height: mainHeight }">
			<view v-if="isLoading" class="common-loading">
				<image class="loading-img" :src="baseIconUrl + 'icon_loading.png'" />
			</view>
			<view class="card" v-else-if="recordList && recordList.length">
				<!-- <view class="month" v-for="(item, index) in recordList" :key="index">
					<view class="month-item">
						{{item.month}}
					</view> -->
				<view class="data" v-for="(items, index) in recordList" :key="index">
					<view class="data-once">
						<view style="display: flex;align-items: center;">
							<image class="image" src="../../static/icon/xiaofei.png" mode=""></image>
							<view class="">{{items.valueName}}</view>
						</view>
						<view class="inte">
							<!-- {{ $methods.handlePositiveNumber(items.principal, items.gift) }} -->
							{{items.topUpMoney}}元
						</view>
					</view>
					<view class="data-tiwice">
						<view class="time">
							{{ items.topUpTime }}
						</view>
						<view class="order">
							<span style="color: #000;margin-right: 15rpx;">折扣率:</span>{{ items.discount }}
						</view>

					</view>
					<view class="data-info">
						<view class="order storeName">
							<view class="order_box ellipsis-text ">充值门店: <span>{{ items.topUpStore }}</span></view>
							<view class="order_box1 ellipsis-text">推荐技师:<span>{{ items.technicianName || '无' }}</span></view>
						</view>
						<view class="itemName order">
							<view class="order_box ellipsis-text">赠送方式:<span>{{ items.giftWay }}</span></view>
							<view class="order_box1 ellipsis-text ">赠送金额:<span>{{ items.giftMoney }}</span></view>
						</view>
						<view class="itemName order">
							<view class="order_box ellipsis-text">优惠券名称:<span>{{ items.couponNames || '无' }}</span></view>
							<view class="order_box1 ellipsis-text">优惠券数量:<span>{{ items.couponNumber || '无'  }}</span></view>
						</view>
						<view class="order technicianName">
							<view class="order_box ellipsis-text">支付方式: <span>{{ items.payWay }}</span></view>
						</view>
					</view>
				</view>
				<!-- </view> -->
			</view>
			<view v-else class="common-no-data">
				<image class="no-data-img" :src="baseImgUrl + 'img_no_project.png'" alt="" />
				<view class="text">暂无消费记录</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	import NavBar from '@/components/nav-bar'
	import api_storedCard from '@/api/storedCard'
	import pageConfig from '@/config'
	export default {
		components: {
			NavBar
		},
		data() {
			return {
				baseImgUrl: pageConfig.baseImgUrl,
				baseIconUrl: pageConfig.baseIconUrl,
				regionId: '',
				recordList: [],
				isLoading: false,
				mainHeight: ''
			}
		},
		onLoad(options) {
			this.mainHeight = this.$store.getters.heightData.noTabMainHeight
			this.regionId = options.id
			this.getRecordList()
		},
		methods: {
			getRecordList() {
				this.isLoading = true
				api_storedCard.appletBuyCardDetail().then(res => {
					this.isLoading = false
					if (res.code !== 200) return
					this.recordList = res.data
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.page {
		background-color: #fff;

		.search {
			margin: 0 40rpx;
		}

		.card {
			padding: 16rpx;
			// display: flex;
			// flex-direction: column;
			// align-items: center;

			.month-item {
				width: 673rpx;
				height: 62rpx;
				background: #F6F6F6;
				border-radius: 0rpx 0rpx 0rpx 0rpx;
				opacity: 1;
				margin: 0 auto;
				line-height: 62rpx;
				padding-left: 16rpx;

			}

			.data {
				width: 676rpx;
				margin: 20rpx auto;
				font-size: 34rpx;
				font-family: Source Han Sans CN, Source Han Sans CN;
				padding: 25rpx;
				box-shadow: 0 0 5px #e1e1e1;
				border-radius: 5px;
				box-sizing: border-box;


				.data-once {
					display: flex;
					justify-content: space-between;
					align-items: center;
					color: #000;
					height: 50rpx;

					.image {
						width: 35rpx;
						height: 35rpx;
						margin-right: 10rpx;
					}

					.inte {
						color: #7d3228;
					}
				}

				.data-tiwice {
					display: flex;
					font-size: 26rpx;
					font-family: Source Han Sans CN, Source Han Sans CN;
					font-weight: 400;
					justify-content: space-between;
					align-items: center;
					color: #adadad;
					border-bottom: 1px solid #b6b6b6;
					height: 80rpx
				}

				.data-info {
					font-size: 27rpx;
					font-family: Source Han Sans CN, Source Han Sans CN;
					// font-weight: 400;
					margin-top: 5rpx;
					color: #adadad;

					.order {
						width: 100%;
						height: 50rpx;
						line-height: 50rpx;
						display: flex;

						.order_box {
							width: 55%;
						}

						span {
							color: #000;
							margin-left: 10rpx;
							
						}
						// // 单行省略号
						// .ellipsis-text {
						//   white-space: nowrap; /* 不换行 */
						//   overflow: hidden; /* 内容溢出时隐藏 */
						//   text-overflow: ellipsis; /* 显示省略号 */
						// }

					}
				}
			}
		}
	}
</style>